package com.example.dailyrecord.entity;

import lombok.Data;

@Data
public class Token {
    private String token;
    private String data;
    private boolean expire;
    private boolean exception;

    private Token(String token, String data, boolean expire, boolean exception) {
        this.token = token;
        this.data = data;
        this.expire = expire;
        this.exception = exception;
    }

    public static Token getSuccess(String token, String data) {
        return new Token(token, data, false, false);
    }

    public static Token getExpire(String token) {
        return new Token(token, null, true, false);
    }

    public static Token getError(String token) {
        return new Token(token, null, false, true);
    }

    public boolean useful() {
        return !exception && !expire;
    }
}
